#!/bin/bash

echo "张杰 谢娜 韩红 许嵩" >singer1.txt
echo "飞的更高 好兄弟 雪 吻得太逼真 棉花糖" >music.txt
singer=(`cat singer1.txt`)
music=(`cat music.txt`)
echo -e "\e[35m歌手有${#singer[@]}位： ${singer[@]}\e[0m"
echo -e "\e[32m歌曲有${#music[@]}首： ${music[@]}\e[0m"
for i in `seq 50`
do
	a=$[RANDOM%4]
	b=$[RANDOM%5]
	if [[ ${singer[$a]} != '' ]]
	then
		if [[ ${music[$b]} != '' ]]
		then
			echo -n -e "\e[34m选出的歌手是:${singer[$a]}\t\e[0m"
			echo -e "\e[33m演唱的歌曲是 ${music[$b]}\e[0m"
			sleep 2
			unset singer[$a]
			unset music[$b]
		fi
	fi
done
